/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine - graphics/scene
// Copyright (c) 2015.  All Rights Reserved
//
// File:		AESceneManagerI.h
// Author:		Gianluca Belardelli
// Date:		30/06/2015
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AESCENEMANAGERI_H_
#define _AESCENEMANAGERI_H_

/// \brief
///   Interface providing the Vision engine with data about the scene. 
/// 
/// The scene manager knowns about all visibility zones in the scene and provides functionality for
/// managing and organizing the visibility nodes.
/// 
/// Registering a scene manager (either the default implementation or a custom solution) is
/// required to make the Vision engine work correctly.
/// 
/// By default, the VisionSceneManager_cl class is used.
class AESceneManagerI : public AEReferencedObject
{
// Members
protected:
	AETArray<AEVisibilityZone *> m_arrVisibilityZones;

// Methods
public:
	/** @name Costruttore e distruttore*/
	/// @{
	/// \brief
	///   Constructor of the IVisSceneManager_cl interface.
	AE_DLLIMPEXP AESceneManagerI( void );

	/// @}
	/// \brief
	///   Virtual Destructor of the IVisSceneManager_cl interface.
	AE_DLLIMPEXP virtual ~AESceneManagerI( void );

	/** @name Visibility Zone Management */
	/// @{

	/// \brief
	///   Adds a visibility zone to the scene manager. The scene manager performs reference counting,
	///   so the refcount of the added zone is increased.
	AE_DLLIMPEXP void AddVisibilityZone( AEVisibilityZone *lpZone );

	/// \brief
	///   Removes a visibility zone from the scene manager. The scene manager performs reference
	///   counting, so the refcount of the removed zone is decreased.
	AE_DLLIMPEXP void RemoveVisibilityZone( AEVisibilityZone *lpZone );

	/// \brief
	///   Removes all visibility zones from the scene manager.
	AE_DLLIMPEXP void RemoveAllVisibilityZones( void );

	/// \brief
	///   Returns the number of visibility zones registered with the scene manager.
	AE_FORCEINLINE AEINT32 GetNumVisibilityZones( void ) const;

	/// \brief
	///   Returns a pointer to the visibility zone with the specified index.
	AE_FORCEINLINE AEVisibilityZone *GetVisibilityZone( AEINT32 nZoneIndex ) const;

	/// \brief
	///   Checks whether this scene manager contains the passed visibility zone.
	AE_FORCEINLINE AEBOOL32 ContainsVisibilityZone( AEVisibilityZone *lpZone );

	/// \brief
	///   Overridable that is called every frame by the application's Run function to handle
	///   all zones.
	/// 
	/// This function is the core of streaming handling as it is responsible for loading/unloading
	/// the zones.
	/// 
	/// See default implementation in the VisionSceneManager_cl class.
	///
	/// \param fTimeDelta
	///   Time delta passed since the last tick.
	AE_DLLIMPEXP virtual void HandleZones( AEFLOAT32 fTimeDelta ) = 0;

};

#include "AESceneManagerI.inl"

typedef AESmartPtr<AESceneManagerI> AESceneManagerIPtr;

#endif // _AESCENEMANAGERI_H_
